/* Copyright (c) 2025 Beijing Semidrive Technology Corporation
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/** *****************************************************************************************************
 *  \file     McuLp.h                                                                                   *
 *  \brief    This file contains interface header for MCULP MCAL driver                                 *
 *                                                                                                      *
 * <table>                                                                                              *
 * <tr><th>Date           <th>Version                                                                   *
 * <tr><td>2023/08/03     <td>1.0.0                                                                     *
 * </table>                                                                                             *
 *******************************************************************************************************/

#ifndef MCULP_H
#define MCULP_H


#ifdef __cplusplus
extern "C" {
#endif
/********************************************************************************************************
 *                                      Include header files                                            *
 *******************************************************************************************************/
#include "Std_Types.h"
#include "Mcu_GeneralTypes.h"
#include "Mbox.h"
#include "Lp_comm.h"

/********************************************************************************************************
 *                                 Global Macro definition                                              *
 *******************************************************************************************************/

/**
 *  \name McuLp RESET GENERAL REG
 */

#define RESET_GENERAL_REG_ROM_CTRL_ID               (0U)
#define RESET_GENERAL_REG_ROM_CTRL_RAM_LP           (14U)
#define RESET_GENERAL_REG_SF_BOOT_ID                (3U)
#define RESET_GENERAL_REG_SF_BOOT_SKIP_KICK_LP      (1U)
#define RESET_GENERAL_REG_SF_BOOT_CR52_LP_MB_READY  (2U)
#define RESET_GENERAL_REG_SF_BOOT_CR5LP_LP_MB_READY (3U)

/**
 *  \name McuLp Error Codes
 *
 *  Error codes returned by McuLp functions
 *
 */
/** \brief  ERROR:Error due to timeout occurred. */
#define MCULP_E_TIMEOUT             ((uint8)0x81U)

/** \brief  ERROR:Error due invalid parameters. */
#define MCULP_E_PARAMS              ((uint8)0x82U)

/** \brief  ERROR:Error due mailbox init error. */
#define MCULP_E_MBOX_ERR            ((uint8)0x83U)

/** \brief  ERROR:Error due mailbox no init. */
#define MCULP_E_MBOX_NO_INIT        ((uint8)0x84U)

/** \brief  ERROR:Error due CR5LP mailbox no init. */
#define MCULP_E_CR5LP_MBOX_NO_INIT  ((uint8)0x85U)

/********************************************************************************************************
 *                                  Global Types definition                                             *
 *******************************************************************************************************/
/**
 * @brief McuLp Module Type
 */
typedef struct McuLp_ModuleType {
    sdrv_mbox_t       *mbox_dev;          /* mbox device  */
    sdrv_mbox_chan_t  *mbox_chan;         /* mbox channel */
} McuLp_ModuleType;

/********************************************************************************************************
 *                                  Global Function Declarations                                        *
 *******************************************************************************************************/

Std_ReturnType McuLp_Init(sdrv_mbox_t *dev);

void McuLp_gpio_alloc2_core(uint32 pin_index, uint32 core);

Std_ReturnType McuLp_LpStateGet(void (*callback)(lp_state_t *));

Std_ReturnType McuLp_LpCustomGet(void (*callback)(void *));

#ifdef __cplusplus
}
#endif

#endif /* MCULP_H */
/* End of file */
